<template>
    <div class="product-param" :class="{'is_fixed':isFixed}">
        <div class="container">
            <div class="product-param-title">
                {{title}}
            </div>
            <div class="product-param-info">
                <a href="">概述</a><span>|</span>
                <a href="">参数</a><span>|</span>
                <a href="">用户评价</a>
                <slot name="buy"></slot>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        name: "product-param",
        props:{
            title:String
        },
        data(){
            return{
                isFixed:false
            }
        },
        mounted() {
            window.addEventListener('scroll',this.initHeight)
        },
        methods:{
            initHeight(){
                let scrollTop = window.pageYOffset || document.documentElement.scroll() || document.body.scrollTo()
                this.isFixed = scrollTop > 152?true:false;
            }
        },
        destroyed() {
            window.removeEventListener('scroll',this.initHeight)
        }
    }
</script>

<style lang="scss">
    @import "./../../assets/scss/base.scss";
    @import "./../../assets/scss/mixin.scss";
    @import "./../../assets/scss/config.scss";
.product-param{
    height: 70px;
    line-height: 70px;
    border: 1px solid $colorH;
    background-color: #fff;
    &.is_fixed{
        position: fixed;
        top: 0;
        width: 100%;
        box-shadow: 0 5px 5px #cccccc;
        z-index: 30;
    }
    .container{
        @include flex();
        .product-param-title{
            font-size: $fontH;
            color: $colorB;
            font-weight: bold;
        }
        .product-param-info{
            font-size: $fontJ;
            span{
                margin: 0 10px;
            }
            a{
                color: $colorC;

            }

        }
    }
}
</style>
